package com.ruoyi.bigScreen;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.core.domain.zzw.TCaseAnalyse;
import com.ruoyi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ITCaseAnalyseService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 民转刑案件类型分析Controller
 * 
 * @author ruoyi
 * @date 2023-11-21
 */
@RestController
@RequestMapping("/system/analyse")
@Api(tags = "重点/突发事件管理")
public class TCaseAnalyseController extends BaseController
{
    @Autowired
    private ITCaseAnalyseService tCaseAnalyseService;

    /**
     * 查询民转刑案件类型分析列表
     */
    @GetMapping("/list")
    @ApiOperation("重点事件列表")
    public AjaxResult list(TCaseAnalyse tCaseAnalyse)
    {
        List<TCaseAnalyse> list = tCaseAnalyseService.selectTCaseAnalyseList(tCaseAnalyse);
        return success(list);
    }

    /**
     * 导出民转刑案件类型分析列表
     */
    @PreAuthorize("@ss.hasPermi('system:analyse:export')")
    @Log(title = "民转刑案件类型分析", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TCaseAnalyse tCaseAnalyse)
    {
        List<TCaseAnalyse> list = tCaseAnalyseService.selectTCaseAnalyseList(tCaseAnalyse);
        ExcelUtil<TCaseAnalyse> util = new ExcelUtil<TCaseAnalyse>(TCaseAnalyse.class);
        util.exportExcel(response, list, "民转刑案件类型分析数据");
    }

    /**
     * 获取民转刑案件类型分析详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:analyse:query')")
    @GetMapping(value = "/{cCaseAnalysisId}")
    @ApiOperation("重点事件详情")
    public AjaxResult getInfo(@PathVariable("cCaseAnalysisId") Long cCaseAnalysisId)
    {
        return success(tCaseAnalyseService.selectTCaseAnalyseByCCaseAnalysisId(cCaseAnalysisId));
    }

    /**
     * 新增民转刑案件类型分析
     */
    @PreAuthorize("@ss.hasPermi('system:analyse:add')")
    @Log(title = "民转刑案件类型分析", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TCaseAnalyse tCaseAnalyse)
    {
        return toAjax(tCaseAnalyseService.insertTCaseAnalyse(tCaseAnalyse));
    }

    /**
     * 修改民转刑案件类型分析
     */
    @PreAuthorize("@ss.hasPermi('system:analyse:edit')")
    @Log(title = "民转刑案件类型分析", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TCaseAnalyse tCaseAnalyse)
    {
        return toAjax(tCaseAnalyseService.updateTCaseAnalyse(tCaseAnalyse));
    }

    /**
     * 删除民转刑案件类型分析
     */
    @PreAuthorize("@ss.hasPermi('system:analyse:remove')")
    @Log(title = "民转刑案件类型分析", businessType = BusinessType.DELETE)
	@DeleteMapping("/{cCaseAnalysisIds}")
    public AjaxResult remove(@PathVariable Long[] cCaseAnalysisIds)
    {
        return toAjax(tCaseAnalyseService.deleteTCaseAnalyseByCCaseAnalysisIds(cCaseAnalysisIds));
    }
}
